<?php

use think\facade\Route;
use app\adminapi\middleware\OperateLog;
use app\adminapi\middleware\JwtAuth;
use app\adminapi\middleware\CheckPermission;

// 配置路由
Route::group('sys_config', function () {
    Route::get('index', 'system.SysConfig/index')->name('sys_config:list')->setOption('real_name', '获取配置列表');
    Route::get('getConfig/:mark', 'system.SysConfig/getConfig')->name('sys_config:getConfig')->setOption('real_name', '获取配置');
    Route::get('getConfigFormList', 'system.SysConfig/getConfigFormList')->name('sys_config:getConfigFormList')->setOption('real_name', '获取配置表单数据');
    Route::post('updateConfigValue', 'system.SysConfig/updateConfigValue')->name('sys_config:updateConfigValue')->setOption('real_name', '编辑配置值');
    Route::get('read/:id', 'system.SysConfig/read')->name('sys_config:detail')->setOption('real_name', '获取配置详情');
    Route::post('save', 'system.SysConfig/save')->name('sys_config:add')->setOption('real_name', '添加配置');
    Route::put('update/:id', 'system.SysConfig/update')->name('sys_config:update')->setOption('real_name', '编辑配置');
    Route::delete('delete/:id', 'system.SysConfig/delete')->name('sys_config:delete')->setOption('real_name', '删除配置');
})->middleware([JwtAuth::class, CheckPermission::class, OperateLog::class]);

// 配置分组路由
Route::group('sys_config_group', function () {
    Route::get('index', 'system.SysConfigGroup/index')->name('sys_config_group:list')->setOption('real_name', '获取系统配置分组');
    Route::get('read/:id', 'system.SysConfigGroup/read')->name('sys_config_group:detail')->setOption('real_name', '获取系统配置分组详情');
    Route::post('save', 'system.SysConfigGroup/save')->name('sys_config_group:add')->setOption('real_name', '添加系统配置分组');
    Route::put('update/:id', 'system.SysConfigGroup/update')->name('sys_config_group:update')->setOption('real_name', '编辑系统配置分组');
    Route::delete('delete/:id', 'system.SysConfigGroup/delete')->name('sys_config_group:delete')->setOption('real_name', '删除系统配置分组');
})->middleware([JwtAuth::class, CheckPermission::class, OperateLog::class]);

// 操作日志
Route::group('operate_log', function () {
    Route::get('index', 'system.OperateLog/index')->name('operate_log:list')->setOption('real_name', '获取操作日志列表');
    Route::get('read/:id', 'system.OperateLog/read')->name('operate_log:detail')->setOption('real_name', '获取操作日志详情');
    Route::post('save', 'system.OperateLog/save')->name('operate_log:add')->setOption('real_name', '添加操作日志');
    Route::put('update/:id', 'system.OperateLog/update')->name('operate_log:update')->setOption('real_name', '编辑操作日志');
    Route::delete('delete/:id', 'system.OperateLog/delete')->name('operate_log:delete')->setOption('real_name', '删除操作日志');
})->middleware([JwtAuth::class, CheckPermission::class, OperateLog::class]);

// 登录日志
Route::group('login_log', function () {
    Route::get('index', 'system.AdminLoginLog/index')->name('login_log:list')->setOption('real_name', '登录日志列表');
    Route::get('read/:id', 'system.AdminLoginLog/read')->name('login_log:detail')->setOption('real_name', '登录日志详情');
})->middleware([JwtAuth::class, CheckPermission::class, OperateLog::class]);

// 应用升级
Route::group('version', function () {
    Route::get('index', 'system.Version/index')->name('version:list')->setOption('real_name', '获取应用升级列表');
    Route::get('read/:id', 'system.Version/read')->name('version:detail')->setOption('real_name', '获取应用升级详情');
    Route::post('save', 'system.Version/save')->name('version:add')->setOption('real_name', '添加应用升级');
    Route::put('update/:id', 'system.Version/update')->name('version:update')->setOption('real_name', '编辑应用升级');
    Route::delete('delete/:id', 'system.Version/delete')->name('version:delete')->setOption('real_name', '删除应用升级');
})->middleware([JwtAuth::class, CheckPermission::class, OperateLog::class]);